import { guideRouters } from './guide-router'

export const weixinRouter = {
  path: '/weixin',
  name: 'weixin',
  title: '微信',
  childre: [
    {
      path: '/sign',
      name: 'signin',
      meta: {
        title: '活动签到'
      },
      component: () => import('@/components/weixin/SignIn')
    }, 
    {
      path: '/signsuccess',
      name: 'signsuccess',
      meta: {
        title: '活动签到成功'
      },
      component: () => import('@/components/weixin/SignSuccess')
    }
  ]
}

export const prompRouter = {
  path: '/promp',
  name: 'promp',
  title: '未开通提示',
  component: () => import('@/components/server/Promp'),
}

export const errorRouter = {
  path: '/*',
  name: 'error-404',
  meta: {
    title: '404-页面不存在'
  },
  component: () => import('@/components/error-page/ErrorPage'),
}



// 页头顶部导航(便于书写)
export const headerRouter = [
  {
    path: '/home',
    name: 'Home',
    title: '首页',
    icon: 'static/logo_index.png',
    component: () => import('@/components/home/Home'),
  }, 
  {
    path: '/invitetender',
    name: 'invitetender',
    title: '招标',
    component: () => import('@/components/invite-tenders/InvitetendersList')
  },
  {
    path: '/recruitlist',
    name: 'recruitlist',
    title: '招聘',
    component: () => import('@/components/recruit/RecruitList'),
  },
  {
    path: '/ec',
    name: 'ec',
    title: '企业',
    component: () => import('@/components/ec/EcMap'),
  },
  {
    path: '/topic',
    name: 'topic',
    title: '话题',
    component: () => import('@/components/topic/TopicHome'),
  },
  {
    path: '/advisory',
    name: 'advisory',
    title: '资讯',
    component: () => import('@/components/advisory/Advisory'),
  },
  {
    path: '/abort',
    name: 'abort',
    title: '关于我们',
    component: () => import('../App'),
    children: [
      guideRouters,
      {
        path: 'abortme',
        name: 'abortme',
        title: '关于我们',
        component: () => import('@/components/abort/AbortMe')
      },
      {
        path: 'legalsupport',
        name: 'legalsupport',
        title: '法律支持',
        component: () => import('@/components/abort/LegalSupport')
      },
      {
        path: 'suggestion',
        name: 'suggestion',
        title: '意见建议',
        component: () => import('@/components/abort/Suggestion')
      },
    ]
  }
]

export const homeRouter = [
  {
    path: '/ec/eclist',
    name: 'eclist',
    title: '企业列表',
    component: () => import('@/components/ec/EcList'),
  },
  {
    path: '/ec/echome/:id',
    name: 'echome',
    title: '企业首页',
    component: () => import('@/components/ec/EcHome'),
  },
  {
    path: '/topic/topicdetails',
    name: 'topicdetails',
    title: '话题详情',
    component: () => import('@/components/topic/TopicDetails'),
  },
  
  {
    path: '/recruitlist/recruitdetails/:id',
    name: 'recruitdetails',
    title: '招聘详情',
    component: () => import('@/components/recruit/RecruitDetails'),
  },
  {
    path: '/forgetps',
    name: 'ForgetPassword',
    title: '忘记密码',
    component: () => import('@/components/login/ForgetPassword'),
  },
  {
    path: '/vippreview',
    name: 'VipPreview',
    title: '会员申请表单预览',
    component: () => import('@/components/vipform/Preview'),
  },
  {
    path: '/awardpreview',
    name: 'awardpreview',
    title: '工程奖申请表单预览',
    component: () => import('@/components/awardapp/AwardPreview'),
  },
  {
    path: '/advisory/eventdetails',
    name: 'eventdetails',
    title: '活动详情',
    component: () => import('@/components/eventregist/EventDetails'),
  },
  {
    path: '/ecedit',
    name: 'ecedit',
    meta: {
      requireAuth: true
    },
    title: '企业主页编辑',
    component: () => import('@/components/ec/EcEdit'),
  },
  {
    path: '/ecpriview',
    name: 'ecpriview',
    title: '企业主页预览',
    component: () => import('@/components/ec/EcPriview'),
  },
  {
    path: '/vitaepreview/:id',
    name: 'vitaepreview',
    meta: {
      requireAuth: true
    },
    title: '简历预览',
    component: () => import('@/components/vitae/VitaePreview'),
  },
  {
    path: '/invitetender/invitetenderinfo/:id/:type',
    name: 'invitetenderinfo',
    title: '招标详情',
    component: () => import('@/components/invite-tenders/InvitetenderInfo')
  },
]

export const appRouter = [
  {
    path: '/personal',
    name: 'personal',
    title: '用户设置',
    icon: 'static/zhanghushezhi.png',
    meta: {
      requiresAuth: true
    },
    component: () => import('@/components/PersonalOper'),
    children: [
      {
        path: '/setting',
        name: 'person-setting',
        title: '基本信息',
        component: () => import('@/components/PersonSetting'),
      },
      {
        path: '/EnterpriseCertification',
        name: 'EnterpriseCertification',
        title: '企业认证',
        component: () => import('@/components/EnterpriseCertification'),
        children: []
      },
      {
        path: '/chps',
        name: 'changpassword',
        title: '修改密码',
        component: () => import('@/components/server/ChangePassword'),
      },
      {
        path: '/chph',
        name: 'changphone',
        title: '变更绑定手机',
        component: () => import('@/components/server/ChangePhone'),
      },
      {
        path: '/curriculumvitae',
        name: 'curriculumvitae',
        title: '个人简历',
        hidden: (userType) => {
          return userType === 'CMEMBER' || userType === 'COMPANY'
        },
        component: () => import('@/components/vitae/CurriculumVitae'),
      },
      {
        path: '/positionmanage',
        name: 'positionmanage',
        title: '职位管理',
        hidden: (userType) => {
          return userType !== 'CMEMBER' && userType !== 'COMPANY'
        },
        component: () => import('@/components/position/PositionManage'),
      },
      {
        path: '/submitrecord',
        name: 'submitrecord',
        title: '投递记录',
        hidden: (userType) => {
          return userType === 'CMEMBER' || userType === 'COMPANY'
        },
        component: () => import('@/components/submit-record/SubmitRecord'),
      },
      {
        path: '/recruit',
        name: 'publishrecruit',
        title: '发布招聘',
        hidden: (userType) => {
          return userType !== 'CMEMBER' && userType !== 'COMPANY'
        },
        props: true,
        component: () => import('@/components/recruit/PublishRecruit'),
      }
    ]
  },
  {
    path: '/leaguer',
    name: 'leaguer',
    title: '会员业务',
    icon: 'static/huiyuanyewu.png',
    meta: {
      requiresAuth: true
    },
    component: () => import('@/components/PersonalOper'),
    children: [
      {
        path: '/vip',
        name: 'vip',
        title: '会员申请',
        component: () => import('@/components/VipApp')
      },
      {
        path: '/eventlist',
        name: 'eventlist',
        title: '活动报名',
        component: () => import('@/components/eventregist/EventList'),
      },
      {
        path: '/eventform',
        name: 'eventform',
        title: '活动报名',
        hidden: true,
        component: () => import('@/components/eventregist/EventForm'),
      },
      {
        path: '/job',
        name: 'job',
        title: '初级职称申请',
        component: () => import('@/components/JobApp'),
        children: []
      },
      {
        path: '/jobform',
        name: 'jobform',
        title: '初级职称申请',
        hidden: true,
        component: () => import('@/components/jobappform/JobappForm')
      },
      {
        path: '/awardapp',
        name: 'awardapp',
        title: '工程奖申请',
        component: () => import('@/components/AwardApp'),
        children: []
      },
      {
        path: '/awardform',
        name: 'awardform',
        title: '工程奖申请',
        hidden: true,
        component: () => import('@/components/awardapp/AwardForm'),
      }
    ]
  },
  {
    path: '/personal',
    name: 'PersonalOper',
    title: '消息通知',
    icon: 'static/xiaoxitongzhi.png',
    meta: {
      requiresAuth: true
    },
    component: () => import('@/components/PersonalOper'),
    children: [
      {
        path: '/notification',
        name: 'notification',
        title: '消息通知',
        meta: {
          requiresAuth: true
        },
        component: () => import('@/components/notification/Notification')
      }
    ]
    
  },
]

export const routers = [
  weixinRouter,
  {
    path: '/',
    name: 'app',
    title: '应用',
    component: () => import('@/components/home/ChApp'),
    children: [
      ...headerRouter,
      ...homeRouter,
      ...appRouter,
      prompRouter,
      errorRouter
    ]
  }
]
